<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <span class="erweima">二维码</span>
    </div>
    <script>
        //父节点：node.parentNode
        //子节点返回的是离着最近的父节点，若没有父节点返回的是null
        var er = document.querySelector('.erweima')
        console.log(er.parentNode);
    </script>
</body>
</html>